//
//  WBCommonModel.m
//  WeatherBar
//
//  Created by Bert on 2024/6/19.
//

#import "WBCommonModel.h"

@implementation WBCommonModel

- (instancetype)init {
    if (self = [super init]) {
        [self wb_configBase];
        [self wb_config];
    }
    return self;
}

- (void)wb_configBase {
    NSDictionary *var_dic = [WBInfoManager wb_shareInstance].var_businessInfo;
    self.appid = [var_dic valueForKey:@"appid"];
    self.ch = [var_dic valueForKey:@"ch"];
    self.ch_biz = [var_dic valueForKey:@"ch_biz"];
    self.ch_sub = [var_dic valueForKey:@"ch_sub"];
    self.district = [var_dic valueForKey:@"district"];
    self.ctime = kGetCurentTime;
    
    CLLocation *var_location = [WBLocationManager sharedManager].currentLocation;
    self.latitude = [NSString stringWithFormat:@"%f",var_location.coordinate.latitude];
    self.longitude = [NSString stringWithFormat:@"%f",var_location.coordinate.longitude];
    
    WBUserModel *var_model = [WBUserManager shareManager].userModel;
    self.sessionId = [WBInfoManager wb_shareInstance].var_sessionId;
    self.tokenId = [UIDevice wb_createUUID];
    self.swv = [self wb_appVersion];
    self.ugid = var_model.userGid;
    self.utime = kGetCurentTime;
    self.zuid = [UIDevice wb_getZuid];
}

- (void)wb_config {
    
}

- (NSString *)wb_appVersion {
    //获取本地版本号
    NSDictionary *var_infoDic = [[NSBundle mainBundle] infoDictionary];
    NSString *var_version = [var_infoDic objectForKey:@"CFBundleShortVersionString"];
    return var_version;
}

@end
